import request from '@/utils/request'

export const getEquipmentList = function(params) {
  return request({
    url: '/api/vm-service/vm/search',
    method: 'GET',
    params
  })
}

export const getTypeList = function() {
  return request({
    url: '/api/vm-service/vmType/search',
    method: 'GET'
  })
}

export const getNodeList = function() {
  return request({
    url: '/api/vm-service/node/search',
    method: 'GET'
  })
}

export const addManagement = function(data) {
  return request({
    url: '/api/vm-service/vm',
    method: 'POST',
    data
  })
}
export const updataManagement = function(data) {
  return request({
    url: `/api/vm-service/vm/${data.id}/${data.nodeId}`,
    method: 'PUT',
    data
  })
}

export const getStrategyList = function() {
  return request({
    url: '/api/vm-service/policy',
    method: 'GET'
  })
}

export const useStrategy = function(data) {
  return request({
    url: '/api/vm-service/vm/applyPolicy',
    method: 'PUT',
    data
  })
}

export const getPolicyName = function(params) {
  return request({
    url: '/api/vm-service/policy/vmPolicy/' + params.id,
    method: 'GET'
  })
}

export const cancelCL = function(data) {
  return request({
    url: `/api/vm-service/vm/cancelPolicy/${data.innerCode}/${data.policyId}`,
    method: 'PUT'
  })
}

export const getWayDetail = function(id) {
  return request({
    url: '/api/vm-service/channel/channelList/' + id,
    method: 'GET'
  })
}

export const getService = function(params) {
  return request({
    url: `/api/task-service/task/repairCount/${params.innerCode}/${params.start}/${params.end}`,
    method: 'GET',
    params
  })
}

export const getReplenishment = function(params) {
  return request({
    url: `/api/task-service/task/supplyCount/${params.innerCode}/${params.start}/${params.end}`,
    method: 'GET',
    params
  })
}
// 销量
export const getSales = function(params) {
  return request({
    url: `/api/order-service/report/skuCollect/${params.innerCode}/${params.start}/${params.end}`,
    method: 'GET',
    params
  })
}
